<%@ page import="com.goal98.grails.plugin.account.domain.Debit; com.goal98.team.domain.Team" %>


<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <title><g:message code="activity.edit" default="Edit Activity" /></title>
    </head>
    <body>
        <div class="nav">
            %{--<span class="menuButton"><a class="home" href="${createLinkTo(dir: '')}"><g:message code="home" default="Home" /></a></span>--}%
            <span class="menuButton"><g:link class="list" action="list"><g:message code="activity.list" default="Activity List" /></g:link></span>
            <span class="menuButton"><g:link class="create" action="create"><g:message code="activity.new" default="New Activity" /></g:link></span>
        </div>
        <div class="body">
            <h1><g:message code="activity.edit" default="Edit Activity" /></h1>
            <g:if test="${flash.message}">
            <div class="message"><g:message code="${flash.message}" args="${flash.args}" default="${flash.defaultMessage}" /></div>
            </g:if>
            <g:hasErrors bean="${activityInstance}">
            <div class="errors">
                <g:renderErrors bean="${activityInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form method="post" >
                <g:hiddenField name="id" value="${activityInstance?.id}" />
                <g:hiddenField name="version" value="${activityInstance?.version}" />
                <div class="dialog">
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="activityTime"><g:message code="activity.activityTime" default="Activity Time" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: activityInstance, field: 'activityTime', 'errors')}">
                                    <g:datePicker name="activityTime" value="${activityInstance?.activityTime}" precision="minute" ></g:datePicker>
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="actualPersonCount"><g:message code="activity.actualPersonCount" default="Actual Person Count" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: activityInstance, field: 'actualPersonCount', 'errors')}">
                                    <input type="text" id="actualPersonCount" name="actualPersonCount" value="${fieldValue(bean:activityInstance,field:'actualPersonCount')}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="costs"><g:message code="activity.costs" default="Costs" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: activityInstance, field: 'costs', 'errors')}">
                                    <g:select name="costs"
from="${Debit.list()}"
size="5" multiple="yes" optionKey="id"
value="${activityInstance?.costs}" />

                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="description"><g:message code="activity.description" default="Description" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: activityInstance, field: 'description', 'errors')}">
                                    <input type="text" id="description" name="description" value="${fieldValue(bean:activityInstance,field:'description')}"/>
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="personAttend"><g:message code="activity.personAttend" default="Person Attend" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: activityInstance, field: 'personAttend', 'errors')}">
                                    
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="team"><g:message code="activity.team" default="Team" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: activityInstance, field: 'team', 'errors')}">
                                    <g:select optionKey="id" from="${Team.list()}" name="team.id" value="${activityInstance?.team?.id}" ></g:select>
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="costOfEachPerson"><g:message code="activity.costOfEachPerson" default="Cost Of Each Person" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: activityInstance, field: 'costOfEachPerson', 'errors')}">
                                    <input type="text" id="costOfEachPerson" name="costOfEachPerson" value="${fieldValue(bean:activityInstance,field:'costOfEachPerson')}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="totalCost"><g:message code="activity.totalCost" default="Total Cost" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: activityInstance, field: 'totalCost', 'errors')}">
                                    <input type="text" id="totalCost" name="totalCost" value="${fieldValue(bean:activityInstance,field:'totalCost')}" />
                                </td>
                            </tr>
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:actionSubmit class="save" action="update" value="${message(code: 'update', 'default': 'Update')}" /></span>
                    <span class="button"><g:actionSubmit class="delete" action="delete" value="${message(code: 'delete', 'default': 'Delete')}" onclick="return confirm('${message(code: 'delete.confirm', 'default': 'Are you sure?')}');" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
